﻿using System.ComponentModel;

namespace RiskMan.DataClass.Models.Sterling
{
    /// <summary>
    /// Модель StackWatch
    /// </summary>
    public class SterlingStockWatchModel : INotifyPropertyChanged
    {
        #region private

        private string _askExch;
        private string _bbo;
        private string _bidExch;
        private string _companyName;
        private string _cusip;
        private string _exch;
        private string _exDivDate;
        private string _lastExch;
        private string _listingExch;
        private string _symbol;
        private string _tradeCondition;
        private string _underlying;
        private string _updateTime;

        private double _52WeekHigh;
        private double _52WeekLow;
        private double _askPrice;
        private double _beta;
        private double _bidPrice;
        private double _closePrice;
        private double _divAmt;
        private double _eps;
        private double _highPrice;
        private double _lastPrice;
        private double _lowPrice;
        private double _openPrice;
        private double _premiumMultiplier;
        private double _vwap;

        private long _askSize;
        private long _avgVolume;
        private long _bidSize;
        private long _cumVolume;
        private long _divFreq;
        private long _lastSize;
        private long _openInterest;
        private long _nPremiumMultiplier;
        private long _quoteCondition;
        private long _sharesOutstanding;
        private long _sharesPerContract;
        private long _spCode;

        private bool _bAskPrice;
        private bool _bBidPrice;
        private bool _bHighPrice;
        private bool _bLastPrice;
        private bool _bLowPrice;
        private bool _bOpenPrice;

        #endregion

        #region public

        #region string
        /// <summary>
        /// Exchange associated with the ask quote
        /// </summary>
        public string AskExch
        {
            get { return _askExch; }
            set
            {
                if (_askExch != value)
                {
                    _askExch = value;
                    RaisePropertyChanged("AskExch");
                }
            }
        }

        /// <summary>
        /// ‘B’= best bid, ‘A’=best ask, ‘X’=best bid and ask
        /// </summary>
        public string Bbo
        {
            get { return _bbo; }
            set
            {
                if (_bbo != value)
                {
                    _bbo = value;
                    RaisePropertyChanged("Bbo");
                }
            }
        }

        /// <summary>
        /// Exchange associated with the bid quote
        /// </summary>
        public string BidExch
        {
            get { return _bidExch; }
            set
            {
                if (_bidExch != value)
                {
                    _bidExch = value;
                    RaisePropertyChanged("BidExch");
                }
            }
        }
        /// <summary>
        /// Company associated to the equity symbol
        /// </summary>
        public string CompanyName
        {
            get { return _companyName; }
            set
            {
                if (_companyName != value)
                {
                    _companyName = value;
                    RaisePropertyChanged("CompanyName");
                }
            }
        }
        /// <summary>
        /// Identifier associated to equities
        /// </summary>
        public string Cusip
        {
            get { return _cusip; }
            set
            {
                if (_cusip != value)
                {
                    _cusip = value;
                    RaisePropertyChanged("Cusip");
                }
            }
        }
        /// <summary>
        /// Returns the exchange from the request.
        /// </summary>
        public string Exch
        {
            get { return _exch; }
            set
            {
                if (_exch != value)
                {
                    _exch = value;
                    RaisePropertyChanged("Exch");
                }
            }
        }
        /// <summary>
        /// Ex-dividend date
        /// </summary>
        public string ExDivDate
        {
            get { return _exDivDate; }
            set
            {
                if (_exDivDate != value)
                {
                    _exDivDate = value;
                    RaisePropertyChanged("ExDivDate");
                }
            }
        }
        /// <summary>
        /// Exchange with the last trade
        /// </summary>
        public string LastExch
        {
            get { return _lastExch; }
            set
            {
                if (_lastExch != value)
                {
                    _lastExch = value;
                    RaisePropertyChanged("LastExch");
                }
            }
        }
        /// <summary>
        /// The exchange where the symbol is listed.
        /// </summary>
        public string ListingExch
        {
            get { return _listingExch; }
            set
            {
                if (_listingExch != value)
                {
                    _listingExch = value;
                    RaisePropertyChanged("ListingExch");
                }
            }
        }
        /// <summary>
        /// The symbol.
        /// </summary>
        public string Symbol
        {
            get { return _symbol; }
            set
            {
                if (_symbol != value)
                {
                    _symbol = value;
                    RaisePropertyChanged("Symbol");
                }
            }
        }
        /// <summary>
        /// Trade Condition on the last trade.
        /// </summary>
        public string TradeCondition
        {
            get { return _tradeCondition; }
            set
            {
                if (_tradeCondition != value)
                {
                    _tradeCondition = value;
                    RaisePropertyChanged("TradeCondition");
                }
            }
        }
        /// <summary>
        /// Underlying symbol of the options symbol
        /// </summary>
        public string Underlying
        {
            get { return _underlying; }
            set
            {
                if (_underlying != value)
                {
                    _underlying = value;
                    RaisePropertyChanged("Underlying");
                }
            }
        }
        /// <summary>
        /// Time of the last quote update
        /// </summary>
        public string UpdateTime
        {
            get { return _updateTime; }
            set
            {
                if (_updateTime != value)
                {
                    _updateTime = value;
                    RaisePropertyChanged("UpdateTime");
                }
            }
        }


        #endregion

        #region double
        /// <summary>
        /// The 52 week high.
        /// </summary>
        public double F52WeekHigh
        {
            get { return _52WeekHigh; }
            set
            {
                if (_52WeekHigh != value)
                {
                    _52WeekHigh = value;
                    RaisePropertyChanged("F52WeekHigh");
                }
            }
        }
        /// <summary>
        /// The 52 week low.
        /// </summary>
        public double F52WeekLow
        {
            get { return _52WeekLow; }
            set
            {
                if (_52WeekLow != value)
                {
                    _52WeekLow = value;
                    RaisePropertyChanged("F52WeekLow");
                }
            }
        }
        /// <summary>
        /// The Ask Price.
        /// </summary>
        public double AskPrice
        {
            get { return _askPrice; }
            set
            {
                if (_askPrice != value)
                {
                    _askPrice = value;
                    RaisePropertyChanged("AskPrice");
                }
            }
        }
        /// <summary>
        /// Not available at this time
        /// </summary>
        public double Beta
        {
            get { return _beta; }
            set
            {
                if (_beta != value)
                {
                    _beta = value;
                    RaisePropertyChanged("Beta");
                }
            }
        }
        /// <summary>
        /// The bid price.
        /// </summary>
        public double BidPrice
        {
            get { return _bidPrice; }
            set
            {
                if (_bidPrice != value)
                {
                    _bidPrice = value;
                    RaisePropertyChanged("BidPrice");
                }
            }
        }
        /// <summary>
        /// The previous day close.
        /// </summary>
        public double ClosePrice
        {
            get { return _closePrice; }
            set
            {
                if (_closePrice != value)
                {
                    _closePrice = value;
                    RaisePropertyChanged("ClosePrice");
                }
            }
        }
        /// <summary>
        /// The dividend amount.
        /// </summary>
        public double DivAmt
        {
            get { return _divAmt; }
            set
            {
                if (_divAmt != value)
                {
                    _divAmt = value;
                    RaisePropertyChanged("DivAmt");
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public double Eps
        {
            get { return _eps; }
            set
            {
                if (_eps != value)
                {
                    _eps = value;
                    RaisePropertyChanged("Eps");
                }
            }
        }
        /// <summary>
        /// Intraday High.
        /// </summary>
        public double HighPrice
        {
            get { return _highPrice; }
            set
            {
                if (_highPrice != value)
                {
                    _highPrice = value;
                    RaisePropertyChanged("HighPrice");
                }
            }
        }
        /// <summary>
        /// The Last price.
        /// </summary>
        public double LastPrice
        {
            get { return _lastPrice; }
            set
            {
                if (_lastPrice != value)
                {
                    _lastPrice = value;
                    RaisePropertyChanged("LastPrice");
                }
            }
        }
        /// <summary>
        /// Intraday Low.
        /// </summary>
        public double LowPrice
        {
            get { return _lowPrice; }
            set
            {
                if (_lowPrice != value)
                {
                    _lowPrice = value;
                    RaisePropertyChanged("LowPrice");
                }
            }
        }
        /// <summary>
        /// The opening price.
        /// </summary>
        public double OpenPrice
        {
            get { return _openPrice; }
            set
            {
                if (_openPrice != value)
                {
                    _openPrice = value;
                    RaisePropertyChanged("OpenPrice");
                }
            }
        }
        /// <summary>
        /// This is the multiplier for options positions. This is for non-integer return values.
        /// </summary>
        public double PremiumMultiplier
        {
            get { return _premiumMultiplier; }
            set
            {
                if (_premiumMultiplier != value)
                {
                    _premiumMultiplier = value;
                    RaisePropertyChanged("PremiumMultiplier");
                }
            }
        }
        /// <summary>
        /// Vwap calculation.
        /// </summary>
        public double Vwap
        {
            get { return _vwap; }
            set
            {
                if (_vwap != value)
                {
                    _vwap = value;
                    RaisePropertyChanged("Vwap");
                }
            }
        }

        #endregion

        #region long
        /// <summary>
        /// Number of shares on the Ask quote.
        /// </summary>
        public long AskSize
        {
            get { return _askSize; }
            set
            {
                if (_askSize != value)
                {
                    _askSize = value;
                    RaisePropertyChanged("AskSize");
                }
            }
        }
        /// <summary>
        /// The average volume for the last 30 days.
        /// </summary>
        public long AvgVolume
        {
            get { return _avgVolume; }
            set
            {
                if (_avgVolume != value)
                {
                    _avgVolume = value;
                    RaisePropertyChanged("AvgVolume");
                }
            }
        }
        /// <summary>
        /// Number of shares on the Bid quote.
        /// </summary>
        public long BidSize
        {
            get { return _bidSize; }
            set
            {
                if (_bidSize != value)
                {
                    _bidSize = value;
                    RaisePropertyChanged("BidSize");
                }
            }
        }
        /// <summary>
        /// The cumulative volume.
        /// </summary>
        public long CumVolume
        {
            get { return _cumVolume; }
            set
            {
                if (_cumVolume != value)
                {
                    _cumVolume = value;
                    RaisePropertyChanged("CumVolume");
                }
            }
        }
        /// <summary>
        /// 0, 3=Not Available, 1= Annual, 2= Semi-Annual, 4=Quarterly
        /// </summary>
        public long DivFreq
        {
            get { return _divFreq; }
            set
            {
                if (_divFreq != value)
                {
                    _divFreq = value;
                    RaisePropertyChanged("DivFreq");
                }
            }
        }
        /// <summary>
        /// The number of shares in the last trade.
        /// </summary>
        public long LastSize
        {
            get { return _lastSize; }
            set
            {
                if (_lastSize != value)
                {
                    _lastSize = value;
                    RaisePropertyChanged("LastSize");
                }
            }
        }
        /// <summary>
        /// Shows the open interest in options quotes
        /// </summary>
        public long OpenInterest
        {
            get { return _openInterest; }
            set
            {
                if (_openInterest != value)
                {
                    _openInterest = value;
                    RaisePropertyChanged("OpenInterest");
                }
            }
        }
        /// <summary>
        /// Shows the open interest in options quotes
        /// </summary>
        public long NPremiumMultiplier
        {
            get { return _nPremiumMultiplier; }
            set
            {
                if (_nPremiumMultiplier != value)
                {
                    _nPremiumMultiplier = value;
                    RaisePropertyChanged("NPremiumMultiplier");
                }
            }
        }
        /// <summary>
        /// Denotes irregular trade conditions
        /// </summary>
        public long QuoteCondition
        {
            get { return _quoteCondition; }
            set
            {
                if (_quoteCondition != value)
                {
                    _quoteCondition = value;
                    RaisePropertyChanged("QuoteCondition");
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public long SharesOutstanding
        {
            get { return _sharesOutstanding; }
            set
            {
                if (_sharesOutstanding != value)
                {
                    _sharesOutstanding = value;
                    RaisePropertyChanged("SharesOutstanding");
                }
            }
        }
        /// <summary>
        /// Shares per contract in an options symbol.
        /// </summary>
        public long SharesPerContract
        {
            get { return _sharesPerContract; }
            set
            {
                if (_sharesPerContract != value)
                {
                    _sharesPerContract = value;
                    RaisePropertyChanged("SharesPerContract");
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public long SpCode
        {
            get { return _spCode; }
            set
            {
                if (_spCode != value)
                {
                    _spCode = value;
                    RaisePropertyChanged("SpCode");
                }
            }
        }

        #endregion

        #region Bool
        /// <summary>
        /// Informs if Ask is valid.
        /// </summary>
        public bool BAskPrice
        {
            get { return _bAskPrice; }
            set
            {
                if (_bAskPrice != value)
                {
                    _bAskPrice = value;
                    RaisePropertyChanged("BAskPrice");
                }
            }
        }
        /// <summary>
        /// Informs if Bid is valid.
        /// </summary>
        public bool BBidPrice
        {
            get { return _bBidPrice; }
            set
            {
                if (_bBidPrice != value)
                {
                    _bBidPrice = value;
                    RaisePropertyChanged("BBidPrice");
                }
            }
        }
        /// <summary>
        /// Informs if High is valid.
        /// </summary>
        public bool BHighPrice
        {
            get { return _bHighPrice; }
            set
            {
                if (_bHighPrice != value)
                {
                    _bHighPrice = value;
                    RaisePropertyChanged("BHighPrice");
                }
            }
        }
        /// <summary>
        /// Informs if Last is valid.
        /// </summary>
        public bool BLastPrice
        {
            get { return _bLastPrice; }
            set
            {
                if (_bLastPrice != value)
                {
                    _bLastPrice = value;
                    RaisePropertyChanged("BLastPrice");
                }
            }
        }
        /// <summary>
        /// Informs if Low is valid.
        /// </summary>
        public bool BLowPrice
        {
            get { return _bLowPrice; }
            set
            {
                if (_bLowPrice != value)
                {
                    _bLowPrice = value;
                    RaisePropertyChanged("BLowPrice");
                }
            }
        }
        /// <summary>
        /// Informs is Open is valid.
        /// </summary>
        public bool BOpenPrice
        {
            get { return _bOpenPrice; }
            set
            {
                if (_bOpenPrice != value)
                {
                    _bOpenPrice = value;
                    RaisePropertyChanged("BOpenPrice");
                }
            }
        }


        #endregion

        #endregion
        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
